package com.yufeng.collaboration.service.impl;

import com.yufeng.collaboration.entity.DocumentUser;
import com.yufeng.collaboration.mapper.DocumentUserMapper;
import com.yufeng.collaboration.service.DocumentUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DocumentUserServiceImpl implements DocumentUserService {
    @Autowired
    private DocumentUserMapper documentUserMapper;

    @Override
    public List<DocumentUser> getDocumentUsersByDocumentId(Integer documentId) {
        return documentUserMapper.selectList(new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<DocumentUser>().eq("document_id", documentId));
    }

    @Override
    public void addDocumentUser(DocumentUser documentUser) {
        documentUserMapper.insert(documentUser);
    }

    @Override
    public void deleteDocumentUser(Integer id) {
        documentUserMapper.deleteById(id);
    }

}